package com.springboot.framework.response;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;

/*链式set*/
@Data
@Accessors(chain = true)
public class JSONResult<T> implements Serializable {
    /*状态信息*/
    private Integer code;
    /*提示信息*/
    private String message;
    /*信息主体*/
    private T data;

    public static <T> JSONResult<T> build(int code,String message,T data){
        return new JSONResult<T>()
                .setCode(code)
                .setMessage(message)
                .setData(data);
    }
}
